package fr.utbm.aiechat.packets;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class UserFileRequestPacket
{
	private ByteArrayOutputStream stream;

	public UserFileRequestPacket(String filename)
	{
		stream = new ByteArrayOutputStream();
		try
		{
			ObjectOutputStream dataObj = new ObjectOutputStream(stream);
			
			dataObj.writeInt(Packets.USERFILE_REQUEST);
			
			dataObj.writeObject(filename);
		}
		catch (IOException e)
		{
			e.printStackTrace();
		}
	}
	
	public byte[] getPacket()
	{
		return stream.toByteArray();
	}
}

